﻿@model BrnMall.Manager.Domain.AddressBook.Staff

@section header{
    <title>添加配送模板-配送模板</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>
<link type="text/css" rel="stylesheet" href="/components/webuploader/webuploader.css" />
<script type="text/javascript" src="/components/webuploader/webuploader.js"></script>
<script>
        $(function () {
            var imgUploader = WebUploader.create({
                pick: '.uploadBut',
                auto: true,
                swf: '/components/webuploader/Uploader.swf',
                server: '/storeadmin/tool/upload?operation=uploadnewsimage',
                fileVal: 'upload',
                accept: {
                    title: 'Images',
                    extensions: '@ViewData["allowImgType"]',
                    mimeTypes: '*'
                },
                fileSingleSizeLimit: @ViewData["maxImgSize"]
            });

            imgUploader.on('uploadProgress', function(file, percentage) {
                $(".uploadPreview").html("上传中...");
            });

            imgUploader.on('uploadSuccess', function(file, response) {
                var data = response._raw;
                if (data == "-1")
                    $(".uploadPreview").html('图片不能为空');
                else if (data == "-2")
                    $(".uploadPreview").html('图片类型不允许');
                else if (data == "-3")
                    $(".uploadPreview").html('图片太大');
                else {
                    var imgsrc = '@WorkContext.ImageCDN/upload/staff/' + data;
                    $(".uploadPreview").html('<img src="'+imgsrc+'"  />');
                    $("#Avater").val(imgsrc);
                }
            });

            imgUploader.on('uploadError', function(file) {
                $(".uploadPreview").html("上传失败");
            });


        });
</script>
    <script type="text/javascript" src="~/admin_store/scripts/staff/departmentlist.js"></script>
}

@section body{
    <h1 class="rightH1">
		微信小程序 &gt; 店铺管理 &gt; 配送模板 &gt; <span class="rightH1-cur">添加配送模板</span> 
        <div class="right">
            <a href="@Html.Raw(ViewData["referer"].ToString())" class="menuBT"><img src="/admin_store/images/goback.jpg" />返回列表</a>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>

    @using (Html.BeginForm("EditStaffTemplates", "Staff"))
    {
        <div class="addTable">
            @Html.HiddenFor(x => x.Id)
            <table width="100%">
                <tr>
                    <td width="80px" align="right">头像：</td>
                    <td>
                    <div class="upload">
                        <div class="uploadPreview">
                            @if (!string.IsNullOrEmpty(Model.Avater))
                            {
                                <img src="@Model.Avater" alt="" />
                            }
                            else
                            {
                                @:暂无图片
                    }
                        </div>
                        <div class="left">
                            <div class="uploadProgressBar"></div>
                            <div class="uploadBut">选择图片</div>
                        </div>
                    </div>
                    @Html.TextBoxFor(x => x.Avater, new { @class = "hide" })
                    @Html.ValidationMessageFor(x => x.Avater)
                    </td>
                </tr>
                <tr>
                    <td width="80px" align="right">姓名：</td>
                    <td>@Html.TextBoxFor(x => x.Name, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Name)</td>
                </tr>
                <tr>
                    <td width="80px" align="right">个性标签：</td>
                    
                </tr>
                <tr>
                    <td width="80px" align="right">职位：</td>
                    <td>@Html.TextBoxFor(x => x.Position, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Position)</td>
                </tr>
                <tr>
                    <td width="80px" align="right">绑定微信手机号：</td>
                    <td>@Html.TextBoxFor(x => x.Phone, new { @class = "input", size = "35",@readonly="readonly" })</td>
                </tr>
                <tr>
                    <td width="80px" align="right">名片展示手机号：</td>
                    <td>@Html.TextBoxFor(x => x.Mobile, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Mobile)</td>
                </tr>
                <tr>
                    <td width="80px" align="right">微信：</td>
                    
                </tr>
                <tr>
                    <td width="80px" align="right">邮箱：</td>
                    <td>@Html.TextBoxFor(x => x.Email, new { @class = "input", size = "35" })@Html.ValidationMessageFor(x => x.Email)</td>
                </tr>
                <tr>
                    <td width="80px" align="right">地址：</td>
                    
                </tr>
                <tr>
                    <td width="80px" align="right">个性签名：</td>
                    
                </tr>
                <tr>
                    <td width="80px" align="right">语音介绍：</td>
                    
                </tr>
                <tr>
                    <td width="80px" align="right">@Html.HiddenFor(x => x.DepartmentId)
                    所在部门：</td>
                    <td class="depLists"></td>
                </tr>
                <tr>
                    <td width="80px" align="right">照片：</td>
                    
                </tr>
                <tr>
                    <td align="right">&nbsp;</td>
                    <td>
                        <a href="" class="addBt" id="sumbitBut"><img src="/admin_store/images/submit.jpg" /></a>
                        <script type="text/javascript">
                            $(function () {
                                $("#freeorderamount").css("display", "none");
                                $(".freetype").click(function () {
                                    console.log($(this).val())
                                    if ($(this).val() === "2")
                                        $("#freeorderamount").css("display","");
                                    else
                                        $("#freeorderamount").css("display", "none");
                                })

                                $("#sumbitBut").click(function () {
                                    var arr = [];
                                    $.each($('input:checkbox:checked'), function () {
                                        arr.push($(this).val())
                                    });
                                    if (arr.length <= 0) return;
                                    $('#DepartmentId').val(arr.join(','));
                                    $("form:first").submit();
                                    return false;
                                })
                            });
                        </script>
                    </td>
                </tr>
                <tr>
                    <td align="right">&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
            </table>
        </div>
    }
}